/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author andrew
 */
@Entity
@Table(name = "MumuUser")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MumuUser.findAll", query = "SELECT m FROM MumuUser m"),
    @NamedQuery(name = "MumuUser.findByIdUser", query = "SELECT m FROM MumuUser m WHERE m.idUser = :idUser"),
    @NamedQuery(name = "MumuUser.findByNameSurname", query = "SELECT m FROM MumuUser m WHERE m.nameSurname = :nameSurname"),
    @NamedQuery(name = "MumuUser.findByQualification", query = "SELECT m FROM MumuUser m WHERE m.qualification = :qualification"),
    @NamedQuery(name = "MumuUser.findByMail", query = "SELECT m FROM MumuUser m WHERE m.mail = :mail"),
    @NamedQuery(name = "MumuUser.findByPassword", query = "SELECT m FROM MumuUser m WHERE m.password = :password"),
    @NamedQuery(name = "MumuUser.findByIsValidated", query = "SELECT m FROM MumuUser m WHERE m.isValidated = :isValidated"),
    @NamedQuery(name = "MumuUser.findByIsAdministrator", query = "SELECT m FROM MumuUser m WHERE m.isAdministrator = :isAdministrator")})
public class MumuUser implements Serializable {
    @Size(max = 45)
    @Column(name = "bundleID")
    private String bundleID;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idUser")
    private Integer idUser;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nameSurname")
    private String nameSurname;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "qualification")
    private String qualification;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "mail")
    private String mail;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "password")
    private String password;
    @Basic(optional = false)
    @NotNull
    @Column(name = "isValidated")
    private boolean isValidated;
    @Basic(optional = false)
    @NotNull
    @Column(name = "isAdministrator")
    private boolean isAdministrator;
    @ManyToMany(mappedBy = "mumuUserCollection")
    private Collection<Universe> universeCollection;

    public MumuUser() {
    }

    public MumuUser(Integer idUser) {
        this.idUser = idUser;
    }

    public MumuUser(Integer idUser, String nameSurname, String qualification, String mail, String password, boolean isValidated, boolean isAdministrator) {
        this.idUser = idUser;
        this.nameSurname = nameSurname;
        this.qualification = qualification;
        this.mail = mail;
        this.password = password;
        this.isValidated = isValidated;
        this.isAdministrator = isAdministrator;
    }

    public Integer getIdUser() {
        return idUser;
    }

    public void setIdUser(Integer idUser) {
        this.idUser = idUser;
    }

    public String getNameSurname() {
        return nameSurname;
    }

    public void setNameSurname(String nameSurname) {
        this.nameSurname = nameSurname;
    }

    public String getQualification() {
        return qualification;
    }

    public void setQualification(String qualification) {
        this.qualification = qualification;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean getIsValidated() {
        return isValidated;
    }

    public void setIsValidated(boolean isValidated) {
        this.isValidated = isValidated;
    }

    public boolean getIsAdministrator() {
        return isAdministrator;
    }

    public void setIsAdministrator(boolean isAdministrator) {
        this.isAdministrator = isAdministrator;
    }

    @XmlTransient
    public Collection<Universe> getUniverseCollection() {
        return universeCollection;
    }

    public void setUniverseCollection(Collection<Universe> universeCollection) {
        this.universeCollection = universeCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idUser != null ? idUser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MumuUser)) {
            return false;
        }
        MumuUser other = (MumuUser) object;
        if ((this.idUser == null && other.idUser != null) || (this.idUser != null && !this.idUser.equals(other.idUser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "service.MumuUser[ idUser=" + idUser + " ]";
    }

    public String getBundleID() {
        return bundleID;
    }

    public void setBundleID(String bundleID) {
        this.bundleID = bundleID;
    }
    
}
